package com.neuedu.shop.service.impl;

import com.neuedu.shop.entity.User;
import com.neuedu.shop.mapper.UserMapper;
import com.neuedu.shop.service.UserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Qin
 * @since 2021-04-10
 */
@Service
@Transactional
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public void updateUserStatus(User user) {
        //从前端获取传过来的user状态，如果是1，改为0，否则改为
        //做判断
        user.setUserStatus(user.getUserStatus() == 1 ? 0 : 1);
        userMapper.updateUserStatus(user);
    }
}
